<script type="text/javascript">
var successFun=function(res){
if(res.code==200){
	document.location	= res.data.forward;
}else{
	alert('出错了，请重新尝试！');
}
}
$(document).ready(function() { 
	var updateOptions	= {dataType:'json',error:doError,success:doSuccess}
    $('#form').ajaxForm(updateOptions); 
}); 
</script>
<div id="content">
<form id="form" action="{url('Ad','SaveEdit')}" method="post">
<h3 class="title">{if $this->data['id']>0}修改{else}添加{/if}广告代码</h3>
<table class="admin-table">
	<tr>
	<td width="100">名称</td>
	<td>
<input name="name" id="name" type="text" tabindex="1" {if $this->data['info']}value="{$this->data['info']['name']}"{/if} /><span etype='error_info' class="error_info"id="name_info"></span>
	</td>
	</tr>
	<tr>
	<td>位置</td>
	<td>
<select name="position">
<!--{loop $this->data['positions'] $pk $pv}-->
<option value="{$pk}" {if $this->data['info']['position']==$pk}selected{/if}>{$pv}</option>
<!--{/loop}-->
</select>
<span etype='error_info' class="error_info"id="position_info"></span>
	</td>
	</tr>
	<tr>
	<td>广告代码</td>
	<td>
<textarea name="code" id="code" tabindex="2" style="width:550px;height:300px">
{if $this->data['info']}{$this->data['info']['code']}{/if}
</textarea>
<span etype='error_info' class="error_info"id="code_info"></span>
	</td>
	</tr>
	<tr>
	<td>显示顺序</td>
	<td>
<input name="orderby" id="orderby" type="text" tabindex="1" value="{if $this->data['info']}{$this->data['info']['orderby']}{else}0{/if}" />
<span etype='error_info' class="error_info"id="orderby_info">数字越大排在越前面</span>
	</td>
	</tr>
	<tr><td colspan="2"><input id="btnAjaxSubmit" type="submit" value="保存" /><input name="id" type="hidden" value="{$this->data['id']}" /></td></tr>
</table>
</form>
</div>
<script src="{$this->data['baseurl']}js/editor/kindeditor/kindeditor.js"></script>
<script>
KE.show({
id : 'code',
allowUpload : false
});
</script>